home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / include / libpurple / whiteboard.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-04  |  7.9 KB  |  262 lines

  1. /**
  2.  * @file whiteboard.h The PurpleWhiteboard core object
  3.  *
  4.  * purple
  5.  *
  6.  * Purple is the legal property of its developers, whose names are too numerous
  7.  * to list here.  Please refer to the COPYRIGHT file distributed with this
  8.  * source distribution.
  9.  *
  10.  * This program is free software; you can redistribute it and/or modify
  11.  * it under the terms of the GNU General Public License as published by
  12.  * the Free Software Foundation; either version 2 of the License, or
  13.  * (at your option) any later version.
  14.  *
  15.  * This program is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  * GNU General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU General Public License
  21.  * along with this program; if not, write to the Free Software
  22.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  23.  */
  24.  
  25. #ifndef _PURPLE_WHITEBOARD_H_
  26. #define _PURPLE_WHITEBOARD_H_
  27.  
  28. /**
  29.  * Whiteboard PRPL Operations
  30.  */
  31. typedef struct _PurpleWhiteboardPrplOps PurpleWhiteboardPrplOps;
  32.  
  33. #include "account.h"
  34.  
  35. /**
  36.  * A PurpleWhiteboard
  37.  */
  38. typedef struct _PurpleWhiteboard
  39. {
  40.     int state;                       /**< State of whiteboard session */
  41.  
  42.     PurpleAccount *account;            /**< Account associated with this session */
  43.     char *who;                       /**< Name of the remote user */
  44.  
  45.     void *ui_data;                   /**< Graphical user-interface data */
  46.     void *proto_data;                /**< Protocol specific data */
  47.     PurpleWhiteboardPrplOps *prpl_ops; /**< Protocol-plugin operations */
  48.  
  49.     GList *draw_list;                /**< List of drawing elements/deltas to send */
  50. } PurpleWhiteboard;
  51.  
  52. /**
  53.  * The PurpleWhiteboard UI Operations
  54.  */
  55. typedef struct _PurpleWhiteboardUiOps
  56. {
  57.     void (*create)(PurpleWhiteboard *wb);                                 /**< create function */
  58.     void (*destroy)(PurpleWhiteboard *wb);                               /**< destory function */
  59.     void (*set_dimensions)(PurpleWhiteboard *wb, int width, int height); /**< set_dimensions function */
  60.     void (*set_brush) (PurpleWhiteboard *wb, int size, int color);        /**< set the size and color of the brush */
  61.     void (*draw_point)(PurpleWhiteboard *wb, int x, int y,
  62.                        int color, int size);                           /**< draw_point function */
  63.     void (*draw_line)(PurpleWhiteboard *wb, int x1, int y1,
  64.                       int x2, int y2,
  65.                       int color, int size);                            /**< draw_line function */
  66.     void (*clear)(PurpleWhiteboard *wb);                                 /**< clear function */
  67.  
  68.     void (*_purple_reserved1)(void);
  69.     void (*_purple_reserved2)(void);
  70.     void (*_purple_reserved3)(void);
  71.     void (*_purple_reserved4)(void);
  72. } PurpleWhiteboardUiOps;
  73.  
  74. /**
  75.  * PurpleWhiteboard PRPL Operations
  76.  */
  77. struct _PurpleWhiteboardPrplOps
  78. {
  79.     void (*start)(PurpleWhiteboard *wb);                                   /**< start function */
  80.     void (*end)(PurpleWhiteboard *wb);                                     /**< end function */
  81.     void (*get_dimensions)(const PurpleWhiteboard *wb, int *width, int *height); /**< get_dimensions function */
  82.     void (*set_dimensions)(PurpleWhiteboard *wb, int width, int height);   /**< set_dimensions function */
  83.     void (*get_brush) (const PurpleWhiteboard *wb, int *size, int *color); /**< get the brush size and color */
  84.     void (*set_brush) (PurpleWhiteboard *wb, int size, int color);         /**< set the brush size and color */
  85.     void (*send_draw_list)(PurpleWhiteboard *wb, GList *draw_list);        /**< send_draw_list function */
  86.     void (*clear)(PurpleWhiteboard *wb);                                   /**< clear function */
  87.  
  88.     void (*_purple_reserved1)(void);
  89.     void (*_purple_reserved2)(void);
  90.     void (*_purple_reserved3)(void);
  91.     void (*_purple_reserved4)(void);
  92. };
  93.  
  94. #ifdef __cplusplus
  95. extern "C" {
  96. #endif /* __cplusplus */
  97.  
  98. /******************************************************************************/
  99. /** @name PurpleWhiteboard API                                                  */
  100. /******************************************************************************/
  101. /*@{*/
  102.  
  103. /**
  104.  * Sets the UI operations
  105.  *
  106.  * @param ops The UI operations to set
  107.  */
  108. void purple_whiteboard_set_ui_ops(PurpleWhiteboardUiOps *ops);
  109.  
  110. /**
  111.  * Sets the prpl operations for a whiteboard
  112.  *
  113.  * @param wb  The whiteboard for which to set the prpl operations
  114.  * @param ops The prpl operations to set
  115.  */
  116. void purple_whiteboard_set_prpl_ops(PurpleWhiteboard *wb, PurpleWhiteboardPrplOps *ops);
  117.  
  118. /**
  119.  * Creates a whiteboard
  120.  *
  121.  * @param account The account.
  122.  * @param who     Who you're drawing with.
  123.  * @param state   The state.
  124.  *
  125.  * @return The new whiteboard
  126.  */
  127. PurpleWhiteboard *purple_whiteboard_create(PurpleAccount *account, const char *who, int state);
  128.  
  129. /**
  130.  * Destroys a whiteboard
  131.  *
  132.  * @param wb The whiteboard.
  133.  */
  134. void purple_whiteboard_destroy(PurpleWhiteboard *wb);
  135.  
  136. /**
  137.  * Starts a whiteboard
  138.  *
  139.  * @param wb The whiteboard.
  140.  */
  141. void purple_whiteboard_start(PurpleWhiteboard *wb);
  142.  
  143. /**
  144.  * Finds a whiteboard from an account and user.
  145.  *
  146.  * @param account The account.
  147.  * @param who     The user.
  148.  *
  149.  * @return The whiteboard if found, otherwise @c NULL.
  150.  */
  151. PurpleWhiteboard *purple_whiteboard_get_session(const PurpleAccount *account, const char *who);
  152.  
  153. /**
  154.  * Destorys a drawing list for a whiteboard
  155.  *
  156.  * @param draw_list The drawing list.
  157.  */
  158. void purple_whiteboard_draw_list_destroy(GList *draw_list);
  159.  
  160. /**
  161.  * Gets the dimension of a whiteboard.
  162.  *
  163.  * @param wb        The whiteboard.
  164.  * @param width        The width to be set.
  165.  * @param height    The height to be set.
  166.  *
  167.  * @return TRUE if the values of width and height were set.
  168.  */
  169. gboolean purple_whiteboard_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height);
  170.  
  171. /**
  172.  * Sets the dimensions for a whiteboard.
  173.  *
  174.  * @param wb     The whiteboard.
  175.  * @param width  The width.
  176.  * @param height The height.
  177.  */
  178. void purple_whiteboard_set_dimensions(PurpleWhiteboard *wb, int width, int height);
  179.  
  180. /**
  181.  * Draws a point on a whiteboard.
  182.  *
  183.  * @param wb    The whiteboard.
  184.  * @param x     The x coordinate.
  185.  * @param y     The y coordinate.
  186.  * @param color The color to use.
  187.  * @param size  The brush size.
  188.  */
  189. void purple_whiteboard_draw_point(PurpleWhiteboard *wb, int x, int y, int color, int size);
  190.  
  191. /**
  192.  * Send a list of points to draw to the buddy.
  193.  *
  194.  * @param wb    The whiteboard
  195.  * @param list    A GList of points
  196.  */
  197. void purple_whiteboard_send_draw_list(PurpleWhiteboard *wb, GList *list);
  198.  
  199. /**
  200.  * Draws a line on a whiteboard
  201.  *
  202.  * @param wb    The whiteboard.
  203.  * @param x1    The top-left x coordinate.
  204.  * @param y1    The top-left y coordinate.
  205.  * @param x2    The bottom-right x coordinate.
  206.  * @param y2    The bottom-right y coordinate.
  207.  * @param color The color to use.
  208.  * @param size  The brush size.
  209.  */
  210. void purple_whiteboard_draw_line(PurpleWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size);
  211.  
  212. /**
  213.  * Clears a whiteboard
  214.  *
  215.  * @param wb The whiteboard.
  216.  */
  217. void purple_whiteboard_clear(PurpleWhiteboard *wb);
  218.  
  219. /**
  220.  * Sends a request to the buddy to clear the whiteboard.
  221.  *
  222.  * @param wb The whiteboard
  223.  */
  224. void purple_whiteboard_send_clear(PurpleWhiteboard *wb);
  225.  
  226. /**
  227.  * Sends a request to change the size and color of the brush.
  228.  *
  229.  * @param wb    The whiteboard
  230.  * @param size    The size of the brush
  231.  * @param color    The color of the brush
  232.  */
  233. void purple_whiteboard_send_brush(PurpleWhiteboard *wb, int size, int color);
  234.  
  235. /**
  236.  * Gets the size and color of the brush.
  237.  *
  238.  * @param wb    The whiteboard
  239.  * @param size    The size of the brush
  240.  * @param color    The color of the brush
  241.  *
  242.  * @return    TRUE if the size and color were set.
  243.  */
  244. gboolean purple_whiteboard_get_brush(const PurpleWhiteboard *wb, int *size, int *color);
  245.  
  246. /**
  247.  * Sets the size and color of the brush.
  248.  *
  249.  * @param wb    The whiteboard
  250.  * @param size    The size of the brush
  251.  * @param color    The color of the brush
  252.  */
  253. void purple_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int color);
  254.  
  255. /*@}*/
  256.  
  257. #ifdef __cplusplus
  258. }
  259. #endif /* __cplusplus */
  260.  
  261. #endif /* _PURPLE_WHITEBOARD_H_ */
  262.